package com.example.personalblog.controller;

import com.example.personalblog.service.ArticleService;
import com.example.personalblog.vo.DisplayArticle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class ArchivesController {

    @Autowired
    ArticleService articleService;

    @GetMapping("/archives")
    public String getArchives(Model model){
        List<DisplayArticle> archives = articleService.findArchives();

        model.addAttribute("archives",archives);

        return "/archives";

    }


}
